
import $api from './index'
// 获取员工信息
interface GetinformationParasm {
  companyId: string,
  limit?: string,
  page?: string,
  keyWord?: string
}
export const Getinformation = async (res: GetinformationParasm) => {
  const { companyId } = res
  // console.log(companyId)
  const { data } = await $api.get(`/bus/company/findSubAccount?&companyId=${companyId}`)
  // console.log(data)

  return data
}
// 添加
interface AddParasm {
  account: string,
  pwd: string,
  sex: string,
  lxPhone: string,
  lxName: string,
  companyId: string
}
export const Add = async (res: AddParasm) => {
  const { data } = await $api.post('/bus/company/addSubAccount', res)
  return data
}
// 修改
interface ReviseParasm {
  id: string,
  authority: string,
  lxPhone: string,
  lxName: string,
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
  pic?: any
}
export const Revise = async (res: ReviseParasm) => {
  const { data } = await $api.post('/bus/company/updateSubAccount', res)
  return data
}
// 删除
interface DeleteParasm {
  id: string
}
export const Delete = async (res: DeleteParasm) => {
  const { data } = await $api.post('/bus/company/deleteSubAccount', res)
  return data
}
// 查找
export const Find = async (res: GetinformationParasm) => {
  const { companyId, keyWord } = res
  const { data } = await $api.get(`/bus/company/findSubAccount?&companyId=${companyId}&keyWord=${keyWord}`)
  return data
}
// 详情
interface DeleteParasm {
  id: string
}
export const Detail = async (res: DeleteParasm) => {
  const { data } = await $api.post('/bus/company/getAcInfo', res)
  return data
}
